package com.ubtechinc.alpha.mini.wk_robot2

import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel

class MainActivity: FlutterActivity() {

    private val CHANNEL = "com.youbixuan.wk2/channel"

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
            .setMethodCallHandler { call, result ->
                if (call.method == "exitApp") {
                    // 退出应用程序
                    android.os.Process.killProcess(android.os.Process.myPid())
                    System.exit(1)
                    result.success(true)
                } else {
                    result.notImplemented()
                }
            }
    }
}
